//
//  MusicTableViewCell.m
//  CarOfHome2
//
//  Created by 杨建家－52 on 15/9/24.
//  Copyright © 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MusicTableViewCell.h"

@interface MusicTableViewCell ()
@property (nonatomic,strong) UILabel *name;
@property (nonatomic ,strong) UILabel *singerName;
@property (nonatomic,strong) UILabel *favorites;


@end

@implementation MusicTableViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
 self =   [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.name = [[UILabel alloc]init];
        [self.contentView addSubview:self.name];
        self.singerName = [[UILabel alloc]init];
        [self.contentView addSubview:self.singerName];
        self.favorites = [[UILabel alloc]init];
        [self.contentView addSubview:self.favorites];
        self.number = [[UILabel alloc]init];
        [self.contentView addSubview:self.number];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    AppDelegate *dele = [[UIApplication sharedApplication]delegate];
    if (dele.isNight == 1) {
        self.contentView.backgroundColor = [UIColor colorWithRed:77/255.0 green:79/255.0 blue:77/255.0 alpha:1];
        self.name.textColor = [UIColor whiteColor];
        self.singerName.textColor = [UIColor whiteColor];
    }
    else{
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.name.textColor = [UIColor blackColor];
        self.singerName.textColor = [UIColor blackColor];
    }
    self.name.frame = CGRectMake(0.2 * TcWidth, 5 * SAHeight, 0.7 * TcWidth, 0.5 * TcHeight);
    self.number.frame = CGRectMake(0.1 * TcWidth, 15 * SAHeight, 0.2 * TcWidth, 0.5 * TcHeight);
   // self.name.font = [UIFont fontWithName:@"" size:<#(CGFloat)#>]
    self.singerName.frame = CGRectMake(0.2 * TcWidth, 0.5 * TcHeight + 5 * SAHeight, 0.8 * TcWidth, 0.4 * TcHeight);
    

}
- (void)setMusicModel:(MusicModel *)musicModel{
  
    self.name.text = musicModel.name;
    self.name.font = [UIFont fontWithName:@"Arial Unicode MS" size:19];
    float n = [musicModel.favorites floatValue];
    
    self.singerName.text = [NSString stringWithFormat:@"%@  ❤️%.1f万",musicModel.singerName, n / 10000];
    self.singerName.font = [UIFont fontWithName:@"Arial Rounded MT" size:15];
    
    
}
@end
